package com.yuexunit.operationman.nbsy.module.plant.model.impl;

import com.yuexunit.operationman.nbsy.Api.Api;
import com.yuexunit.operationman.nbsy.base.SubmitBean;
import com.yuexunit.operationman.nbsy.module.plant.model.IMaterialAddModel;
import com.yuexunit.operationman.nbsy.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by chenss on 2017/7/21 0021.
 */

public class MaterialAddModel implements IMaterialAddModel {

    Api api;

    public  Api getApiInstance() {
        if(api!=null) {
            return api;
        }else{
            api= ApiUtil.getInstance().createRetrofitApi(Api.class);
            return api;
        }
    }

    @Override
    public Observable<SubmitBean> addMaterial(Map<String, String> praise) {
        api=getApiInstance();
        return api.insertMaterialInfo(praise);
    }
}
